﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace ElectronicCommerce.Framework.Payment.Contract.DataContract.Common
{
    /// <summary>
    /// 网关信息
    /// </summary>
    [DataContract]
    public class Gateway
    {
        public Gateway(string code)
            : this(code, "")
        {
        }

        public Gateway(string code, string address)
        {
            this.Code = code;
            this.Name = "";
            this.Address = address;
            this.RequestType = GatewayRequestType.HttpPost;
            this.CallbackRequestType = GatewayRequestType.HttpPost;
            this.NotifyUrl = "";
            this.ReturnUrl = "";
        }

        /// <summary>
        /// 网关编号
        /// </summary>
        [DataMember]
        public string Code { get; set; }

        /// <summary>
        /// 网关的名称，如Alipay
        /// </summary>
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// 网关地址
        /// </summary>
        [DataMember]
        public string Address { get; set; }

        /// <summary>
        /// 请求网关的类型
        /// </summary>
        [DataMember]
        public GatewayRequestType RequestType { get; set; }

        /// <summary>
        /// 网关返回请求类型
        /// </summary>
        [DataMember]
        public GatewayRequestType CallbackRequestType { get; set; }

        /// <summary>
        /// 通知URL
        /// </summary>
        [DataMember]
        public string NotifyUrl { get; set; }

        /// <summary>
        /// 返回URL
        /// </summary>
        [DataMember]
        public string ReturnUrl { get; set; }

        /// <summary>
        /// 在ReturnUrl/NotifyUrl对应页面处理之后应展示的页面
        /// </summary>
        [DataMember]
        public string ShowUrl { get; set; }
    }
}
